﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data;
using KPIS.GERP.GHRMS.DAL;
using KPIS.GERP.GHRMS.MODEL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.IDAL;
using KPIS.GERP.GHRMS.DALFactory;

namespace KPIS.GERP.GHRMS.BLL
{
    public class AbsenceTypeBLL : IAbsenceTypeBLL
    {
        private static readonly IAbsenceTypeDAL DAL = DataAccess.CreateAbsenceTypes();

        public IList<AbsenceTypeInfo> ListAbsenceTypes()
        {
            return DAL.ListAbsenceTypes(new AbsenceTypeInfo(0));
        }
        public IList<AbsenceTypeInfo> ListAbsenceTypesBySequence(int Sequence)
        {
            return DAL.ListAbsenceTypes(new AbsenceTypeInfo(Sequence));
        }

        public void Insert(string Name,int? ApproveProcessSeq, string Remarks , int CreatedBy)
        {
            try
            {
                DAL.Insert(new AbsenceTypeInfo(0, Name, Remarks, "", CreatedBy, 0){ApproveProcessSeq = ApproveProcessSeq});
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Update(int Sequence,int? ApproveProcessSeq, string Name, string Remarks, int UpdatedBy)
        {
            try
            {
                DAL.Update(new AbsenceTypeInfo(Sequence, Name, Remarks, "", 0, UpdatedBy){ApproveProcessSeq = ApproveProcessSeq});
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Delete(int Sequence, int UpdatedBy)
        {
            try
            {
                DAL.Delete(Sequence, UpdatedBy);
            }
            catch
            {
                throw new Exception("");
            }
        }
        
        public Dictionary<int, string> ListApproveProcess()
        {
            return DAL.ListApproveProcess();
        }
    }
}
